﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using WcfLayer;

namespace ServiceHost
{
    public class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Console Based WCF Host");
            System.ServiceModel.ServiceHost serviceHost = new System.ServiceModel.ServiceHost(typeof(ServiceBioWCF)) ;
            {

                serviceHost.Open();
                Console.WriteLine("The service is ready.");
                #region Output dispatchers listening
                foreach (Uri uri in serviceHost.BaseAddresses)
                {
                    Console.WriteLine("\t{0}", uri.ToString());
                }

                Console.WriteLine();
                Console.WriteLine("Number of dispatchers listening : {0}", serviceHost.ChannelDispatchers.Count);
                foreach (System.ServiceModel.Dispatcher.ChannelDispatcher dispatcher in serviceHost.ChannelDispatchers)
                {
                    Console.WriteLine("\t{0}, {1}", dispatcher.Listener.Uri.ToString(), dispatcher.BindingName);
                }

                Console.WriteLine();
                Console.WriteLine("Press <ENTER> to terminate Host");
                Console.ReadLine();
                #endregion
            }

        }
    }
}
